import { request } from '@/utils/request.js'

/**
 * 工单 API JS
 */

export default {

  /**
   * 获取工单分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'logistics/workOrder/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加工单
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'logistics/workOrder/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新工单数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'logistics/workOrder/update/' + id,
      method: 'put',
      data
    })
  },
  close (id, data = {}) {
    return request({
      url: 'logistics/workOrder/close/' + id,
      method: 'put',
      data
    })
  },

  /**
   * 读取工单
   * @returns
   */
  read (id,data={}) {
    return request({
      url: 'logistics/workOrder/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将工单删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'logistics/workOrder/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取工单数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'logistics/workOrder/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复工单数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'logistics/workOrder/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除工单
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'logistics/workOrder/realDelete',
      method: 'delete',
      data
    })
  },


}